home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 January / macformat46.iso / Shareware Plus / Developers / Library / NGL 2.0 Demo / NGL2.0.0(E)Demo / Font Sample / Font_Sample.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-03  |  2.1 KB  |  95 lines

  1. /*============================================================
  2.  
  3.                     N_Font sample program
  4.                     
  5. ============================================================*/
  6.  
  7. #include        "N_Library.h"
  8.  
  9. void Int_Main_Loop(void);
  10. void Begin_Timer_Int(void* Int_Routine,short Tm_Counter);
  11. void Stop_Timer_Int(void);
  12.  
  13. short        Data_Rsrc = 0;
  14. WindowPtr    window;
  15.  
  16. short        x = 640;
  17. char            mes[] = "WELCOME TO N GAME LIBRARY!  THANK YOU FOR DOWNLOADING/ THIS IS A FONT SAMPLE/@";
  18. Str255        putmes = "\pN";
  19. short        mes_count = 0;
  20. short        dot_count = 14;
  21. short        style = 0;
  22.  
  23. void main(void)
  24. {
  25.     ToolboxInit();
  26.     ColorCheck();                                                            //change color depth
  27.     HideMenuBar();
  28.     HideCursor();
  29.     window = GetNewWindow (128,nil,(WindowPtr)-1L );
  30.     SetPort((GrafPtr)window);
  31.     N_Window_Set(window,-(window->portBits.bounds.left),-(window->portBits.bounds.top),640,480);
  32.     Open_Resource_File(128,1,&Data_Rsrc);
  33.     N_Sp_Make(640,16);                                                        //sprite offscreen make
  34.     N_Cel_Make(65536);                                                        //set up cel plane
  35.     N_Font_Init();
  36.     N_Sprite_Set(130,11,12,16,1,13,4,0);
  37.  
  38.     N_Font_Set(0,0,0,0x80000000,0);                                            //Font Set 0 normal overlap
  39.     N_Font_Set(1,0x80000000+11,0,0x80000000+26+11,0x80000000+37+11);        //Font Set 1 
  40.  
  41.     N_Pict_Draw(128,0,0,(GrafPtr)Main_Window,true);                            //PICT 128
  42.     Close_Resource_File(&Data_Rsrc);
  43.     Begin_Timer_Int(Int_Main_Loop,17);                                        //Timer Interrupt start
  44.     do                                                                        //check mouse button
  45.     {
  46.     }
  47.     while (!Button());
  48.     Stop_Timer_Int();                                                        //Timer Interrupt stop
  49.     ShowCursor();
  50.     ShowMenuBar();
  51.     ColorRevert();
  52. }
  53.  
  54. void Int_Main_Loop(void)
  55. {
  56.     char        me;        
  57.     Rect        sc_rect;
  58.  
  59.     if (dot_count == 0)
  60.     {
  61.         dot_count = 18;
  62.         me = mes[mes_count];
  63.         if (me == '@')
  64.         {
  65.             me = ' ' ;
  66.             mes_count = 0;
  67.             style++;
  68.             if (style == 2) style = 0;
  69.         }
  70.         else
  71.         {
  72.             *(putmes+1) =  me;
  73.             N_Font_Put(putmes,626,430,14,1,0,30);
  74.             mes_count++;
  75.  
  76.             if (style == 1)
  77.             {
  78.                 SetRect(&sc_rect,622,442,640,430+16);
  79.                 ScrollRect(&sc_rect,-1,0,nil);
  80.                 SetRect(&sc_rect,622,438,640,430+16);
  81.                 ScrollRect(&sc_rect,-1,0,nil);
  82.                 SetRect(&sc_rect,622,434,640,430+16);
  83.                 ScrollRect(&sc_rect,-1,0,nil);
  84.             }
  85.         }
  86.     }
  87.     dot_count--;
  88.     SetRect(&sc_rect,0,430,640,430+16);
  89.     ScrollRect(&sc_rect,-1,0,nil);
  90. }
  91.  
  92.  
  93.  
  94.  
  95.